package com.ihunanren.biz.function.domain;

import java.util.Date;

import com.ihunanren.common.CalendarUtil;

public class Time  extends WeixinResp{

	private final String location;

	private final Date now;

	public Time(String location, Date now) {
		this.location = location;
		this.now = now;
	}

	public String toReply() {
		StringBuilder sb = new StringBuilder();
		sb.append("今天是：").append(CalendarUtil.getYear(now)).append("年")
				.append(CalendarUtil.getMonth(now)).append("月")
				.append(CalendarUtil.getDate(now)).append("日，星期")
				.append(getDay()).append("\n农历：")
				.append(CalendarUtil.getChineseDate(now)).append("\n");
		sb.append("北京时间：");
		sb.append(CalendarUtil.formatDate(now, "HH:mm"));
		return sb.toString();
	}

	private String getDay() {
		String day = "";
		switch (CalendarUtil.getDay(now)) {
		case 2:
			day = "一";
			break;
		case 3:
			day = "二";
			break;
		case 4:
			day = "三";
			break;
		case 5:
			day = "四";
			break;
		case 6:
			day = "五";
			break;
		case 7:
			day = "六";
			break;
		case 1:
			day = "日";
			break;
		default:
			break;
		}
		return day;
	}

	public String getLocation() {
		return location;
	}

	public Date getNow() {
		return now;
	}
}
